﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

	<!--ContextMenuItemTemplate-->
	<DataTemplate x:Key="ContextMenuItemTemplate">
		<StackPanel Orientation="Horizontal" Width="150">
			<Image Source="{Binding Image}" Width="16" Margin="3,0,0,0" HorizontalAlignment="Left" />
			<TextBlock Text="{Binding Text}" Margin="11,0,0,0" HorizontalAlignment="Left" />
		</StackPanel>
	</DataTemplate>

	<!--ContextMenuTemplate-->
	<ControlTemplate x:Key="ContextMenuTemplate">
		<Grid Background="WhiteSmoke" Margin="0">
			<Grid>
				<Rectangle Fill="#FFF1F1F1" HorizontalAlignment="Left" Margin="0,0,2,0" Width="28"/>
				<Rectangle Fill="#FFE2E3E3" HorizontalAlignment="Left" Margin="28,0,0,0" Width="1"/>
				<Rectangle Fill="#FFF0F0F0" HorizontalAlignment="Left" Margin="29,0,0,0" Width="1"/>
				<Rectangle Fill="White" HorizontalAlignment="Left" Margin="29,0,0,0" Width="1"/>
				<ItemsPresenter Margin="{TemplateBinding Padding}"/>
			</Grid>
		</Grid>
	</ControlTemplate>

	<!-- ContextMenuItemContainerStyle -->
	<Style x:Key="ContextMenuItemContainerStyle" TargetType="ListBoxItem">
		<Setter Property="Padding" Value="3" />
		<Setter Property="HorizontalContentAlignment" Value="Left" />
		<Setter Property="VerticalContentAlignment" Value="Top" />
		<Setter Property="Background" Value="Transparent" />
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="TabNavigation" Value="Local" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ListBoxItem">
					<Grid Background="{TemplateBinding Background}">
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal" />
								<VisualState x:Name="MouseOver">
									<Storyboard>
										<DoubleAnimation Storyboard.TargetName="fillColor" Storyboard.TargetProperty="Opacity" Duration="0" To=".35"/>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility" Duration="0">
											<DiscreteObjectKeyFrame KeyTime="0">
												<DiscreteObjectKeyFrame.Value>
													<Visibility>Visible</Visibility>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="Disabled">
									<Storyboard>
										<DoubleAnimation Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="Opacity" Duration="0" To=".55" />
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
							<VisualStateGroup x:Name="SelectionStates">
								<VisualState x:Name="Unselected" />
								<VisualState x:Name="Selected">
									<Storyboard>
										<DoubleAnimation Storyboard.TargetName="fillColor2" Storyboard.TargetProperty="Opacity" Duration="0" To=".75"/>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
							<VisualStateGroup x:Name="FocusStates">
								<VisualState x:Name="Focused">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility" Duration="0">
											<DiscreteObjectKeyFrame KeyTime="0">
												<DiscreteObjectKeyFrame.Value>
													<Visibility>Visible</Visibility>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="Unfocused"/>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Rectangle x:Name="fillColor" Opacity="0" IsHitTestVisible="False" RadiusX="1" RadiusY="1">
							<Rectangle.Fill>
								<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
									<GradientStop Color="#FFC2DCFC" Offset="1"/>
									<GradientStop Color="#FFF4F6FA"/>
									<GradientStop Color="#FFD6E7FC" Offset="0.521"/>
									<GradientStop Color="#FFE9F0F0" Offset="0.499"/>
								</LinearGradientBrush>
							</Rectangle.Fill>
						</Rectangle>
						<Rectangle x:Name="fillColor2" Opacity="0" Fill="#FFBADDE9" IsHitTestVisible="False" RadiusX="1" RadiusY="1"/>
						<ContentPresenter
                                x:Name="contentPresenter"
                                Content="{TemplateBinding Content}"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"/>
						<Rectangle x:Name="FocusVisualElement" Stroke="#7F7DA2CE" StrokeThickness="1" Visibility="Collapsed" RadiusX="1" RadiusY="1" />
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

</ResourceDictionary>
